<template>
  <a-table
    :columns="recordTableColumns[type]"
    :data-source="dataSourceRef"
    bordered
  />
</template>

<script setup lang="ts">
import apis from "../../../apis/index";
import recordTableColumns from "../recordTableColumns";
interface PropTypes {
  type: string;
  interface: string;
  requestData: object;
}
const props = withDefaults(defineProps<PropTypes>(), {
  type: "type",
  interface: "title",
  requestData: {}
});
console.log(props, "props-record");
console.log(recordTableColumns, "re");
async function initData(params) {
  try {
    const data = await apis.assessment.getAssessmentList_API(params);
    return data;
  } catch (error) {
    console.log(error, "initData-record-table");
  }
}
const dataSourceRef = ref([]);
function setDataSource(newDataSource: []) {
  dataSourceRef.value = newDataSource;
}
onMounted(async () => {
  // const params = {
  //   page: 1,
  //   size: 5,
  //   ...props.requestData
  // };
  const data = await initData(props.requestData);
  setDataSource(data?.list);
  console.log(dataSourceRef, "datas=");
  console.log(data, "data-record");
});
</script>

<style lang="less" scoped></style>
